
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@page import="ahxu.search.db.PageResults"%>
<%@page import="ahxu.search.db.FinalResult"%>
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils" %>
<%@ page import="org.springframework.web.context.WebApplicationContext" %>
<%@page import="ahxu.search.db.IFinalResultDao"%>
<%
	String pageNoStr=request.getParameter("pageNo");
	int pageNo=1;
	if(StringUtils.isNumeric(pageNoStr)) pageNo=Integer.parseInt(pageNoStr); 
	String sName=request.getParameter("sName");
	request.getSession().setAttribute("sName",sName);
	String sAddress=request.getParameter("sAddress");
	request.getSession().setAttribute("sAddress",sAddress);
	String sPhone=request.getParameter("sPhone");
	request.getSession().setAttribute("sPhone",sPhone);
	int pageSize=50;
    WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(application);
    IFinalResultDao dao=(IFinalResultDao)ctx.getBean("finalResultDao");
    PageResults<FinalResult> results=dao.findResults(sName,sAddress,sPhone,pageNo,pageSize);
    request.setAttribute("results",results);
    RequestDispatcher   rd   =   getServletContext().getRequestDispatcher("/search.jsp");  
	rd.forward(request,response);   
%>